import { get, post, del } from '@/utils/http'

/** 获取笔记列表 */
export const getNoteListAPI = (params: GetNoteListParams) => {
  return get<Note[]>('/wall/getNoteList', { params })
}

/** 获取评论列表 */
export const getCommentListAPI = (wall_id: number, limit: number, page: number) => {
  return get<Comment[]>('/wall/getCommentList', { params: { wall_id, limit, page } })
}

/** 获取卡片详情 */
export const getDetailNoteAPI = (id: number) => {
  return get<Note>('/wall/getNote', { params: { id } })
}

/** 添加笔记 */
export const addNoteAPI = (data: addNoteParams) => {
  return post<void>('/wall/addNote', data)
}

/** 上传图片 */
export const addPictureAPI = (data: any) => {
  return post<{ file_url: string }>('/wall/upload', data)
}

/** 删除留言 */
export const deleteNoteAPI = (id: number) => {
  return del<void>('/wall/deleteNote', { params: { id } })
}

/** 添加评论 */
export const addCommentAPI = (data: AddComment) => {
  return post<void>('/wall/addComment', data)
}

/** 删除评论 */
export const deleteCommentAPI = (id: number, comment_count: number, wall_id: number) => {
  return del<void>('/wall/deleteComment', { params: { id, comment_count, wall_id } })
}

/** 添加反馈 */
export const addFeedbackAPI = (data: addFeedbackParams) => {
  return post<void>('/wall/addFeedback', data)
}

/** 是否反馈 */
export const isFeedbackAPI = (user_id: string, wall_id: number, type: number) => {
  return get<number>('/wall/isFeedback', { params: { user_id, wall_id, type } })
}

/** 删除反馈 */
export const deleteFeedbackAPI = (user_id: string, like_count: number, wall_id: number) => {
  return del<void>('/wall/deleteFeedback', { params: { user_id, like_count, wall_id } })
}

/** 获取反馈列表 */
export const getFeedbackListAPI = (type: number) => {
  return get('/wall/getFeedbackList', { params: { type } })
}
